import { RouteRecordRaw } from 'vue-router'
import Layout from '@/layouts/index.vue'
import BlankLayout from '@/layouts/BlankLayout.vue'

const pagesRouter: RouteRecordRaw = {
  path: '/pages',
  component: Layout,
  redirect: '/pages/list/table',
  name: 'pages',
  meta: { title: '页面', icon: 'el-icon-s-grid', noCache: true },
  children: [
    {
      path: '/pages/list',
      component: BlankLayout,
      name: 'list',
      meta: { title: '列表页面', icon: 'el-icon-s-grid', noCache: true },
      children: [
        {
          path: '/pages/list/table',
          component: () => import('@/views/page-demo/list/table/index.vue'),
          name: 'TableList',
          meta: { title: '表格列表' }
        },
        {
          path: '/pages/list/highly-adaptive-table',
          component: () => import('@/views/page-demo/list/highly-adaptive-table/index.vue'),
          name: 'HighlyAdaptiveTable',
          meta: { title: '高度自适应表格' }
        }
      ]
    },
    {
      path: '/pages/form',
      component: BlankLayout,
      name: 'form',
      meta: { title: '表单页面', icon: 'el-icon-edit-outline', noCache: true },
      children: [
        {
          path: '/pages/form/basic',
          component: () => import('@/views/page-demo/form/basic/index.vue'),
          name: 'BasicForm',
          meta: { title: '基础表单' }
        },
        {
          path: '/pages/form/advanced-form',
          component: () => import('@/views/page-demo/form/advanced-form/index.vue'),
          name: 'AdvancedForm',
          meta: { title: '高级表单', keepAlive: true }
        }
      ]
    },
    {
      path: '/pages/detail',
      component: BlankLayout,
      name: 'detail',
      meta: { title: '详情页面', icon: 'el-icon-document', noCache: true },
      children: [
        {
          path: '/pages/detail/basic',
          component: () => import('@/views/page-demo/detail/basic/index.vue'),
          name: 'BasicDetail',
          meta: { title: '基础列表' }
        },
        {
          path: '/pages/detail/table',
          component: () => import('@/views/page-demo/detail/table/index.vue'),
          name: 'TableForm',
          meta: { title: '表格表单' }
        }
      ]
    }
  ]
}

export default pagesRouter
